/**
 * 二分查找法
 * @param {*} arr 
 * @param {*} target 
 * @returns 
 */
function search(arr, target) {
    let left = 0, right = arr.length - 1;
    while (left <= right) {
        let mid = Math.floor((right + left) / 2);
        if (arr[mid] === target) return true;
        else if (arr[mid] < target) right = mid - 1;
        else left = mid + 1;
    }
    return false;
}

